<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Catalog_options extends CI_Controller {
	var $perpage = 20;
		public function __construct() {
		   parent::__construct();
		   if (!$this->ion_auth->logged_in() || !$this->ion_auth->is_admin()) redirect('auth/login/'.str_replace("/", ".",$_SERVER['REQUEST_URI']));
		   $this->layout->setlayout('admin/layout');
		   $this->crumps->push('/admin/catalog/', 'Характеристики товаров');
		   $this->users_rights_model->check_rights(strtolower(get_class()), $this->router->get_method());
	   }
	   function index() {
			$data['pages'] = $pages = $this->db->select()->from('catalog_optgr')->get()->result_array();
			$data['items'] = $items = $this->db->select()->from('catalog_items')->where('item_parent', $id)->order_by('item_order', 'asc')->get()->result_array();
			$data['active_parent'] = $id;
			$active = $this->db->select()->from('catalog_parents')->where('parent_id', $id)->get()->row_array();
			$data['crumps'] = $this->catalog_service_model->getCrumps($active['parent_path'], 'admin/catalog/index');
			if ($id != 0) $data['active'] = $this->db->select()->from('catalog_parents')->where('parent_id', $id)->get()->row_array();
			$this->layout->view('admin/catalog/index', $data);
	   }

}
